<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="/WEB-INF/struts-html" prefix="html" %>
<html:html>
<head>
	<title></title>
	
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/sampleForm.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/me.css" />	
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/help/help.css" />
	
	<script type='text/javascript' src='<%= request.getContextPath() %>/css/autocomplete/lib/jquery.js' ></script>  	 	

	
	<link type="text/css" href="<%= request.getContextPath() %>/css/datepicker/css/ui.all.css" rel="stylesheet" /> 	
	<script type="text/javascript" src="<%= request.getContextPath() %>/css/datepicker/lib/jquery-ui-1.5.3.min.js"></script>	
	
	<script type="text/javascript">
		$(document).ready(function(){									
    			$("#startDate_taxBuy").datepicker({ altField: 'input#startDate_taxBuy', altFormat: 'dd-mm-yy' });    			
    			$("#endDate_taxBuy").datepicker({ altField: 'input#endDate_taxBuy', altFormat: 'dd-mm-yy' });
    			
    			$("#startDate_materialsInStock").datepicker({ altField: 'input#startDate_materialsInStock', altFormat: 'dd-mm-yy' });
    			$("#endDate_materialsInStock").datepicker({ altField: 'input#endDate_materialsInStock', altFormat: 'dd-mm-yy' });
    			
    			$("#startDate_purchasingMaterials").datepicker({ altField: 'input#startDate_purchasingMaterials', altFormat: 'dd-mm-yy' });
    			$("#endDate_purchasingMaterials").datepicker({ altField: 'input#endDate_purchasingMaterials', altFormat: 'dd-mm-yy' });

    			$("#startDate_dyestuffsChemicals").datepicker({ altField: 'input#startDate_dyestuffsChemicals', altFormat: 'dd-mm-yy' });
    			$("#endDate_dyestuffsChemicals").datepicker({ altField: 'input#endDate_dyestuffsChemicals', altFormat: 'dd-mm-yy' });
  		});
	</script>		
	<script type="text/javascript">
		function validate(startDate, endDate) {
			var valid = true;
/*			if(document.getElementById(startDate).value!="" ) {
				document.getElementById(startDate+"_error").innerHTML = "";
			}else {
				document.getElementById(startDate+"_error").innerHTML = "วันที่ไม่ถูกต้อง";
				valid = false;								
			}				 

			if(document.getElementById(endDate).value !="" ) {				
				document.getElementById(endDate+"_error").innerHTML = "";							
			}else {				
				document.getElementById(endDate+"_error").innerHTML = "วันที่ไม่ถูกต้อง";
				valid = false;				
			}				 			

			if(valid) {
			valid = check_startDate_endDate(startDate, endDate);
			}*/
			return valid;
		}

		function check_startDate_endDate(startDate, endDate) {
			var start_date = new Date(document.getElementById(startDate).value);
			var end_date = new Date(document.getElementById(endDate).value);

			if(start_date>end_date) {
				document.getElementById(startDate+"_error").innerHTML = "วันที่เริ่มต้น มากกว่า วันที่สิ้นสุด";
				document.getElementById(endDate+"_error").innerHTML = "";
				return false;
			}else {
				document.getElementById(startDate+"_error").innerHTML = "";
				document.getElementById(endDate+"_error").innerHTML = "";				
				return true;
			}
		}
		
	</script>
<script type="text/javascript" >

function modalWinItem(aa) {
	if (window.showModalDialog) {		
		window.showModalDialog(aa,"name","dialogTop:100px;dialogWidth:650px;dialogHeight:350px;center:yes");
	} else {		
		window.open(aa,'name','height=350,width=600,toolbar=no,directories=no,status=no,continued from previous linemenubar=no,scrollbars=no,resizable=no ,modal=yes');
	}
}
</script>		
</head>
<body>
<div id="wrapper">
	 
	<div id="menu"><ul id="nav"></ul></div>

	<div id="content">
		<div id="menuNav"><a href='<%=request.getContextPath() %>/Login.do?mode=check'>หน้าหลัก</a> 
		>> คลังพัสดุ-Store กลาง >> บันทึกใบเบิก >> 3.สลับเลขที่ ขอเบิก-ขอซื้อ </div><br />

		<div id="userPw01">
		<fieldset>
			<legend><b>ใบขอเบิก -> ใบขอซื้อ </b></legend>
			   <center>
	    		<html:form action="/swap.do?mode=swap&param=toStkRequest" >
		    	<table >
		    		<tr>
		    			<td align="right">เลขที่ใบเบิก: </td>
		    			<td><html:text property="docNo1" styleId="docNo1" readonly="true" /></td>
		    			<td>
		    				<a href="#" target="name" onclick="modalWinItem('/ittl/stkissue/swap.do?mode=docNoFind&docNoType=stkIssue2&line=1'); return false;">ค้น</a>
		    			</td>
		    			<td align="right">เปลี่ยนเป็น:</td><td>เลขที่ใบขอซื้อ</td>
		    			<td ><html:submit onclick="return validate('docNo1','test');"  /></td>	    			
		    		</tr>
		    		<tr>
		    			<td ></td><td><font color="red"><label id="docNo1_error"/></label></font> </td>
		    			<td ></td><td><font color="red"><label id="docNo2_error"/></label></font> </td>
		    			<td ></td>	    			
		    		</tr>		    				   		    		
		    	</table>
	    		</html:form>
	    	</center>
	    </fieldset>
	    </div>
				
		<div id="userPw01">
		<fieldset>
			<legend><b>ใบขอซื้อ -> ใบขอเบิก </b></legend>
			   <center>
	    		<html:form action="/swap.do?mode=swap&param=toStkIssue2" >
		    	<table >
		    		<tr>
		    			<td align="right">เลขที่ใบขอซื้อ:</td><td><html:text property="docNo2" styleId="docNo2" readonly="true" /></td>
		    			<td>
		    				<a href="#" target="name" onclick="modalWinItem('/ittl/stkissue/swap.do?mode=docNoFind&docNoType=stkRequest&line=2'); return false;">ค้น</a>
		    			</td>		    			
		    			<td align="right">เปลี่ยนเป็น:</td><td>เลขที่ใบขอเบิก</td>
		    			<td ><html:submit onclick="return validate('docNo2','test');"  /></td>	    			
		    		</tr>
		    		<tr>
		    			<td ></td><td><font color="red"><label id="docNo1_error"/></label></font> </td>
		    			<td ></td><td><font color="red"><label id="docNo2_error"/></label></font></td>
		    			<td ></td>	    			
		    		</tr>		    				   		    		
		    	</table>
	    		</html:form>
	    	</center>
	    </fieldset>
	    </div>	    	    			    		
	    	    
    </div>
</div>
</body>
</html:html>
